<?php

/**
 * TAGS信息表
 * File Name：TagsContentModel.php
 * File Encoding：UTF-8
 * File New Time：2014-9-9 11:31:05
 * Author：水平凡
 * Mailbox：admin@abc3210.com
 */
class TagsContentModel extends BaseModel {

    public function tableName() {
        return '{{tags_content}}';
    }

    public function primaryKey() {
        return 'goods_id';
    }

    public function rules() {
        return array(
            array('tagid,tag,goods_name,goods_id,start_time,end_time,cat_id,updatetime', 'safe'),
        );
    }

    public function relations() {
        return array(
            'GoodsModel' => array(self::HAS_ONE, 'GoodsModel', 'goods_id',),
        );
    }

    //数据保存前操作
    protected function beforeSave() {
        //是否新增
        $time = time();
        $this->updatetime = $time;
        return true;
    }

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }

}
